package com.wingsfrog.puzzle.util;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by rankin on 16/4/2.
 */
public class SessionUtil {
    public static String USER_ID = "user_id";

    public static HttpServletRequest getRequest(){
        return((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
    }
    public static Integer getUserId(){
        return (Integer) getRequest().getSession().getAttribute(USER_ID);
    }
}
